package com.xyzwps.paimon.furina.common.value

import com.xyzwps.paimon.furina.common.AppErrorCode
import com.xyzwps.paimon.furina.common.AppException

data class PageSize(val value: Int) {
    init {
        if (value < MIN) throw AppException(AppErrorCode.PAGE_SIZE_INVALID, "Page size cannot be less than $MIN.")
        if (value > MAX) throw AppException(AppErrorCode.PAGE_SIZE_INVALID, "Page size cannot be greater than $MAX.")
    }

    companion object {
        const val MIN = 1
        const val MAX = 100

        val DEFAULT = PageSize(10)
    }
}
